package com.example.demo.controller;

import com.example.demo.bean.Order;
import com.example.demo.bean.User;
import com.example.demo.service.OrderService;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/WorldCupApp/teamboard")
public class OrderController {
    private User data;
    @Autowired
    OrderService service;

    @RequestMapping("/register")
    @ResponseBody
    public Map list(@RequestBody Order user) {
        Map map = new HashMap();
        List<Order> list = service.list();
        if (list != null) {
            map.put("success", true);
            map.put("massage", "注册成功");
            map.put("data", list);
        } else {
            map.put("success", false);
            map.put("massage", "注册失败");
            map.put("data", null);
        }
        return map;
    }

}
